﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;


namespace sdamarketing
{
    public class reklamiZaKorisnici
    {
        //vrati data set so site reklami preporaacni za korisnik
        public DataSet getPodatociZaReklama(int idUser)
        {
            DataSet dataSet = new DataSet();
            String sql = "SELECT PostavenaReklama.idReklama, Link, SlikaURL, Opis, Naslov FROM PostavenaReklama, ReklamiZaKorisnici WHERE PostavenaReklama.idReklama = ReklamiZaKorisnici.idReklama AND ReklamiZaKorisnici.idUser = '" + idUser + "' ";
            SqlConnection connection = ConnectionMenager.GetConnection();
            SqlCommand command = new SqlCommand(sql, connection);
            command.CommandType = CommandType.Text;

            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
            dataAdapter.Fill(dataSet, "PostavenaReklama");

            connection.Close();
            return dataSet;
        }

    }
}
